package view;

import com.alibaba.fastjson.JSON;
import model.ViewForExpress;
import pond.common.STRING;
import pond.web.Render;
import pond.web.Router;
import service.DataBaseService;

import java.util.List;

/**
 * Created by sky_wang on 2017/7/19.
 */
public class Express extends Router {
    private DataBaseService dataBaseService;
    public Express (DataBaseService dataBaseService){
        this.dataBaseService = dataBaseService;
    }

    {
        get("/list", (req, resp) -> {
            List<ViewForExpress> ret = dataBaseService.getDB().get(t -> t.query(ViewForExpress.class,"select * from view_for_express;"));
            resp.render(Render.json(ret));
        });
    }
}

